package com.heima.zrh;

public class demo05 {
    public static void main(String[] args) {
        int[] arr = {123,13,124,45,56,13};
        int[] maxAndMin = getMaxAndMin(arr);
        System.out.println(arr[0]);
        System.out.println(arr[1]);
    }


    public static int[] getMaxAndMin(int[] arr) {
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[0]) {
                max = arr[0];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int[] getMaxAndMin = new int[]{max, min};
        return getMaxAndMin;
    }
}
